Modifying logic of application

Previous: Creating project "Counter"

Modifying the ST-code

The ST-object program already contains a sample application for a counter. The existing application is enhanced just a bit during this step.

  1. In the ST-object program, search for the declaration of the →variable up.
    It is this line: up : BOOL;

  2. Enhance the declaration by the →initial value TRUE.
    Mind that the icon  is shown on the left edge while your are entering the code. This indicates a faulty term in the ST-code.
    Example for errors in the ST-Code: 


    If you are not too familiar with the ST-syntax, use the content assist of Neuron Power Engineer: context menu within ST-editor, Content Assist – Double-click an element in the list.


    Here the error-free ST-code for the declared variable with the initial value TRUE:
     

  3. Save the ST-code: menu File, command Save

Modifying the FBD-logic

The FBD-object Counter already contains a sample application for a counter. The existing application is enhanced just a bit during this step. 

  1. In the FBD-editor press Ctrl+L in order to display the list of the declared variables.

  2. Search for the declaration of the variable up.

  3. Enhance the declaration by the initial value TRUE: Double-click into the column Initial value for the variable, enter TRUE and press the Enter-key.
    This illustration shows how the initial value for the variable up is being modified:

     

  4. Save the FBD-logic: menu File, command Save

 

Continue with: Transferring application to controller


Interested in details? See the following articles in the reference documentation: